<?php

class Core_Model_Foundation_Poi extends Dcmp_Model_Entity {

    public function __construct() {
        parent::__construct();
    }

    public function getStorefrontPicture(){
        if($this->issetData('photo')){
            $result = explode(',', $this->getPhoto());
            return $result[0];
        }
        return '';
    }

    public function updateClickCount(){
        Kd_Data_Factory::getUpdateDcl()->into('{t}poi_visit')
                ->value('click_count', Kd_Data_Dcl_Fn::addition('click_count', 1))
                ->eq('id', ':id:s')
                ->addParameter('id', $this->getId())
                ->execute();
        return $this;
    }

    protected function initializeTable($table) {
        $table->setName('{t}foundation_poi');
        $table->createColumn('id', 'string', TRUE, TRUE);
    }

}